rebind Method |
This method regenerates HTML for all tuples in the busdataisland.
Syntax
elementID.rebind()
Return Value
No return value.
Remarks
The rebind method is used to bind the HTML elements to the tuples in the data island. This can be useful when same data needs to be displayed after filtering one or more fields in the data, or to retrieve a fresh set of records based on certain condition.
Example
The following example shows how rebind() can be used to get the list of rows for a particular set of records which is related to a set of data.
<!-- HTML definition for main table data (diEmployees - ID of the data island) --> <div class="buscontrol"> <div BusDataIsland="diEmployees" xql="." onclick="bindRelatedData(this)"> <!-- HTML Content --> </div> </div> <!-- HTML definition for the related table data - Example, "Orders" --> <div id="relatedData" class="buscontrol" onbeforebind="blockData()" style="display:none"> <div BusDataIsland="diEmployees" xql="Orders"> <!-- HTML Content --> </div> </div> //Function called on onbeforebind event of the related table. This will block the data from display //After blocking the data to be rendered, it will be displayed only on onclick of the main table function blockData() { //check if there is a tuple and whether it is equal to the existing set of tuples //If data does not coincide, then return without rendering if (tuple) { if (tuple != event.tuple) event.returnValue = false; } else event.returnValue = false; } //tuple used for rebinding var tuple = null; //Function that rebinds the related table data to the HTML elements function bindRelatedData(thisElement) { //Make the data HTML visible relatedData.style.display = ""; //Get the correct tuple, which is the XML node of the clicked element tuple = thisElement.xml; //Get the related tuple - through the ancestor property of XMLDOM tuple = tuple.selectSingleNode("ancestor(tuple)"); //Call rebind relatedData.rebind(); }